<?php

namespace App\Enums;

use App\Traits\EnumMethods;

enum RefundState: string
{
    use EnumMethods;

    case INIT = 'init';
    case PROCESS = 'process';
    case FAIL = 'fail';
    case SUCCESS = 'success';

    const STATE_MAP = [
        self::INIT->value => '初始化',
        self::PROCESS->value => '退款处理中',
        self::FAIL->value => '退款失败',
        self::SUCCESS->value => '退款成功',
    ];

    const STATE_LABEL = [
        self::INIT->value => 'default',
        self::PROCESS->value => 'warning',
        self::FAIL->value => 'danger',
        self::SUCCESS->value => 'success',
    ];

    public function toString(): string
    {
        return self::STATE_MAP[$this->value];
    }
}
